<?php
class Ym extends CI_Model{
    
    function index(){
       $q = $this->db->get('ym');
       return $q;
    }
    
    function show($id){
        $this->db->where('id', $id);
        $q = $this->db->get('ym');
        return $q;
    }
    
    function edit($id){
        $this->db->where('id', $id);
        $q = $this->db->get('ym');
        return $q;
    }
    
    function create($name, $email){
        $data = array(
            'name' => $name,
            'email' => $email,
        );
        $this->db->insert('ym', $data);
        redirect('yms/index'); 
    }
    
    function update($id, $name, $email){
         $data = array(
            'name' => $name,
            'email' => $email,
        );
        $this->db->where('id', $id);
        $this->db->update('ym', $data);
        redirect('yms/index');
    }
    
    function admin(){
        $q = $this->db->get('ym');
        return $q;
    }
    

}

?>
